<template>
	<view>
		<view class="bg_FFFFFF u-p-20 u-flex u-row-between">
			<view class="u-b-r-16 u-flex u-w-700" style="background-color: #F5F5F5; padding:0 20rpx ;">
				<u-image src='https://www.sqkjkj.vip/wxImg/mylick/img.png' width='27rpx' height='27rpx'></u-image>
				<view class="u-m-l-20">
					<u-input v-model="params.search" @blur="inputBlur"  />
				</view>
			</view>
		</view>

		<view class="u-p-20 u-auto">
			<view class="u-b-r-10 bg_FFFFFF bs_CCCCCC u-m-t-20 u-p-20" v-for="(item,index) in array" :key="index">
				<view class="u-text-right" @click.stop="remove(item.id)">
					<u-icon name="close-circle-fill" color="#FB473C" size="45"></u-icon>
				</view>
				<view class=" u-flex " >
					<view class="">
						<view class="" v-if="good_id==item.id" @click="good_id=0">
							<u-image src="https://www.sqkjkj.vip/wxImg/car/img2.png" mode="aspectFill" width="40rpx" height='40rpx'>
							</u-image>
						</view>
						<view class="" v-if="num==1 && good_id!=item.id" @click="good_id=item.id">
							<u-image src="https://www.sqkjkj.vip/wxImg/car/img.png" mode="aspectFill" width="40rpx" height='40rpx'>
							</u-image>
						</view>
					</view>
					<view class="u-w-700 u-m-l-20" @click.stop="$u.route(`/pages/shopmassage/shopmassage?num=${item.shop_id}`)">
						<view class="u-flex u-row-between">
							<view class="u-flex ">
								<u-image :src="item.logo" mode="aspectFill" width="94rpx" height='94rpx'
									border-redius='16'>
								</u-image>
								<view class="u-m-l-24">
									<view class="u-flex">
										<view class="u-m-l-10 u-weight">{{item.name}}</view>
									</view>
								</view>
							</view>
						</view>
						<view class="u-flex u-m-t-20">
							<u-image src="https://www.sqkjkj.vip/wxImg/clear/img2.png" mode="aspectFill" width="28rpx" height='28rpx'>
							</u-image>
							<view class="u-m-l-10 u-font-20"><text class="cl_848484FF">电话:</text>{{item.mobile}}</view>
						</view>

						<view class="u-flex u-m-t-20">
							<u-image src="https://www.sqkjkj.vip/wxImg/clear/img4.png" mode="aspectFill" width="28rpx" height='28rpx'>
							</u-image>
							<view class="u-m-l-10 u-font-20 u-m-r-20"><text
									class="cl_848484FF">地址:</text>{{item.area}}{{item.address}}</view>

						</view>
					</view>
				</view>
			</view>
			<!-- 加载更多 -->
			<u-loadmore :status="status" icon-type="circle" margin-top="20" margin-bottom="20" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				num: 0,
				rem: 1,
				array: [],
				params: {
					page: 1,
					page_size: 20,
					search:''
				},
				all: 1,
				good_id: '',
				status: 'loadmore',
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.clear()
			this.massage()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			this.massage();
		},
		methods: {
			inputBlur(){
				this.clear()
				this.massage()
			},
			clear() {
				this.array = [];
				this.params.page = 1;
			},
			massage() {
				this.$api.my_llick_shop(this.params, res => {
					if (res.data.code == 1) {
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.array = this.array.concat(res.data.data.data);
						uni.stopPullDownRefresh();
					}
				})
			},
			remove(id) {
				this.$api.my_llick_shop_remove({
					id
				}, res => {
					if (res.data.code == 1) {
						uni.showToast({
							icon: 'none',
							title: '删除成功'
						})
						this.clear()
						this.massage()
					} else {
						uni.showToast({
							icon: 'none',
							title: res.data.msg
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
	page {
		background: #f5f5f5;
	}
</style>
